﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MuseumOwner.master" AutoEventWireup="true"
    CodeFile="GameDetails.aspx.cs" Inherits="GameDetails" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script src="js/jquery-1.6.2.min.js" type="text/javascript"></script>

    <script src="js/jquery.form.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">
        //        function ShowFile() {
        //            var formId = '<%= this.Form.ClientID %>';
        //            var imageId = '<%= this.imgGameThumb.ClientID %>';
        //            var fileUploadId = '<%= fileGameImage.UniqueID %>';
        //            var r = Math.floor(Math.random() * 999999);
        //            var action = $('#' + formId).attr('action');
        //            $('#' + formId).attr('action', 'GenericHandler.ashx?f=' + fileUploadId);
        //            $('#' + formId).ajaxForm(function() {
        //                $('#' + imageId).attr('src', 'GenericHandler.ashx?s=' + fileUploadId + '&r=' + r);
        //                $('#' + imageId).show();
        //                $('#' + formId).attr('action', action);
        //            });
        //            $('#' + formId).submit();
        //        }
        function numbersonly(e) {
            var unicode = e.charCode ? e.charCode : e.keyCode
            if (unicode != 8) { //if the key isn't the backspace key (which we should allow)
                if (unicode != 46 && unicode > 31 && unicode < 48 || unicode > 57) //if not a number
                    return false //disable key press
            }
        }

        function WatermarkFocus(txtElem, strWatermark) {
            if (txtElem.value == strWatermark) txtElem.value = '';
        }
        function WatermarkBlur(txtElem, strWatermark) {
            if (txtElem.value == '') txtElem.value = strWatermark;
        }

        function Validate() {
            if (document.getElementById("<%=ddlMuseum.ClientID%>").value == "") {
                alert("Please select Museum.");
                document.getElementById("<%=ddlMuseum.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtGameName.ClientID%>").value == "") {
                alert("Game Name can not be blank.");
                document.getElementById("<%=txtGameName.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtGameAlias.ClientID%>").value == "") {
                alert("Game Alias can not be blank.");
                document.getElementById("<%=txtGameAlias.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtGameDescription.ClientID%>").value == "") {
                alert("Game Description can not be blank.");
                document.getElementById("<%=txtGameDescription.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtGamePrice.ClientID%>").value == "") {
                alert("Game Price can not be blank.");
                document.getElementById("<%=txtGamePrice.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtGameDuration.ClientID%>").value == "") {
                alert("Game Duration can not be blank.");
                document.getElementById("<%=txtGameDuration.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtGameVersion.ClientID%>").value == "") {
                alert("Game Version can not be blank.");
                document.getElementById("<%=txtGameVersion.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtAppLink.ClientID%>").value == "") {
                alert("App Link can not be blank.");
                document.getElementById("<%=txtAppLink.ClientID%>").focus();
                return false;
            }
            //            if (document.getElementById("<%=fileGameImage.ClientID%>").value == "") {
            //                alert("Please select Game Image.");
            //                document.getElementById("<%=fileGameImage.ClientID%>").focus();
            //                return false;
            //            }
            if (document.getElementById("<%=txtTreasureName.ClientID%>").value == "") {
                alert("Treasure Name can not be blank.");
                document.getElementById("<%=txtTreasureName.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtTreasureInfo.ClientID%>").value == "") {
                alert("Treasure Info can not be blank.");
                document.getElementById("<%=txtTreasureInfo.ClientID%>").focus();
                return false;
            }
            //            if (document.getElementById("<%=fileTreasureImage.ClientID%>").value == "") {
            //                alert("Please select Treasure Image.");
            //                document.getElementById("<%=fileTreasureImage.ClientID%>").focus();
            //                return false;
            //            }
            if (document.getElementById("<%=txtTotalClues.ClientID%>").value == "") {
                alert("Total Clues can not be blank.");
                document.getElementById("<%=txtTotalClues.ClientID%>").focus();
                return false;
            }
            return true;
        }
        function ClearControls() {
            document.getElementById("<%=txtTotalClues.ClientID%>").value == "";
            document.getElementById("<%=fileTreasureImage.ClientID%>").value == "";
            document.getElementById("<%=txtTreasureInfo.ClientID%>").value == "";
            document.getElementById("<%=txtTreasureName.ClientID%>").value == "";
        }
    </script>

    <table width="100%" cellspacing="3" cellpadding="3" border="0">
        <tr>
            <td colspan="1" align="center">
                <b style="font-size: x-large;">GAME</b>
            </td>
        </tr>
        <tr>
            <td width="35%" style="vertical-align: top">
                <table width="100%">
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <img id="imgGameThumb" height="110" width="110" runat="server" src="" alt="" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblGameImage" Text="Game Image" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <asp:FileUpload ID="fileGameImage" runat="server" Width="190px"></asp:FileUpload>
                            <%--<asp:FileUpload ID="FileUpload1" runat="server" Width="190px" onchange="javascript:ShowFile();"></asp:FileUpload>--%>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblTreasure" Text="Treasure Name" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <asp:TextBox ID="txtTreasureName" runat="server" Width="190px" MaxLength="250"></asp:TextBox>
                            &nbsp;<b style="color: red;">*</b>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblTreasureInfo" Text="Treasure Additional Info" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <asp:TextBox ID="txtTreasureInfo" runat="server" Width="190px" TextMode="MultiLine"
                                Rows="4" MaxLength="1000"></asp:TextBox>
                            &nbsp;<b style="color: red;">*</b>
                        </td>
                    </tr>
                </table>
            </td>
            <td width="65%">
                <table width="100%">
                    <tr>
                        <td>
                            <asp:Label ID="lblMuseumName" Text="Museum" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlMuseum" runat="server" Width="205px" DataTextField="MuseumName"
                                DataValueField="MuseumID">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Label1" Text="Game Name" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <asp:TextBox ID="txtGameName" runat="server" Width="200px" MaxLength="100"></asp:TextBox>
                            &nbsp;<b style="color: red;">*</b>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblGameAlias" Text="Game Alias" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <asp:TextBox ID="txtGameAlias" runat="server" Width="200px" MaxLength="100"></asp:TextBox>
                            &nbsp;<b style="color: red;">*</b>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblGameDescription" Text="Game Description" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <asp:TextBox ID="txtGameDescription" runat="server" Rows="4" TextMode="MultiLine"
                                Width="200px" MaxLength="250"></asp:TextBox>
                            &nbsp;<b style="color: red;">*</b>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblIsActive" Text="Is Active" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlIsActive" runat="server" Width="205px">
                                <asp:ListItem Selected="True" Text="Yes" Value="1"></asp:ListItem>
                                <asp:ListItem Text="No" Value="0"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Label4" Text="Difficulty Level" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlGameLevel" runat="server" Width="205px">
                                <asp:ListItem Selected="True" Text="1" Value="1"></asp:ListItem>
                                <asp:ListItem Text="2" Value="2"></asp:ListItem>
                                <asp:ListItem Text="3" Value="3"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblGamePrice" Text="Game Price" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <div style="float: left;">
                                <asp:TextBox ID="txtGamePrice" runat="server" Width="50px" onkeypress="return numbersonly(event)"
                                    MaxLength="5"></asp:TextBox>
                                &nbsp;<b style="color: red;">*</b>
                            </div>
                            <div style="vertical-align: super; padding-top: -3px;">
                                <span>&nbsp; &nbsp; &nbsp;
                                    <asp:Label ID="lblGameDuration" Text="Duration : " runat="server"></asp:Label>
                                </span>
                                <asp:TextBox ID="txtGameDuration" runat="server" Width="55px" MaxLength="3" onkeypress="return numbersonly(event)"></asp:TextBox>
                                &nbsp;<b style="color: red;">*</b>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblGameVersion" Text="Game Version" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <asp:TextBox ID="txtGameVersion" runat="server" Width="200px" MaxLength="2" onkeypress="return numbersonly(event)"></asp:TextBox>
                            &nbsp;<b style="color: red;">*</b>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblAppLink" Text="App Link" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <asp:TextBox ID="txtAppLink" runat="server" Width="200px"></asp:TextBox>
                            &nbsp;<b style="color: red;">*</b>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblGameType" Text="Game Type" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <div style="float: left;">
                                <asp:DropDownList ID="ddlGameType" runat="server" Width="205px">
                                    <asp:ListItem Selected="True" Text="Scavenger" Value="0"></asp:ListItem>
                                    <asp:ListItem Text="Treasure Hunt" Value="1"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                            <div style="vertical-align: super; padding-top: -3px;">
                                <span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;
                                    <asp:Label ID="lblTotalClues" Text="Total Clues : " runat="server"></asp:Label>
                                </span>
                                <asp:TextBox ID="txtTotalClues" runat="server" Width="50px" MaxLength="2" onkeypress="return numbersonly(event)"></asp:TextBox>
                                &nbsp;<b style="color: red;">*</b>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblTreasureImage" Text="Treasure Image" runat="server"></asp:Label>
                        </td>
                        <td>
                            :
                        </td>
                        <td>
                            <div style="float: left;">
                                <asp:FileUpload ID="fileTreasureImage" runat="server" Width="205px"></asp:FileUpload>
                            </div>
                            <div style="vertical-align: super; padding-top: -3px;">
                                &nbsp;&nbsp;<asp:TextBox ID="txtTreasureImagePath" runat="server" Wrap="true" ReadOnly="true"
                                    TextMode="MultiLine" BorderStyle="None" BorderWidth="0" Width="200px" Rows="1"
                                    Style="overflow: auto; resize: none;" /></div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <asp:Button ID="btnSubmit" Text="Save and Continue" runat="server" OnClick="btnSubmit_Click"
                                OnClientClick="return Validate();" />&nbsp;&nbsp;
                            <asp:Button ID="btnReset" Text="Reset" runat="server" OnClick="btnReset_Click" OnClientClick="return ClearControls();" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <asp:Label ID="lblMessage" runat="server" ForeColor="Red" Visible="true"></asp:Label>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
